package testing.src.vineet.java.code.probs;

public class Permutation 
{ 
	public static void main(String argv[])
	{
		Permutation p = new Permutation();
		String s[] = {"1","2","3"};
		p.printPermutation(s,0);
	}
	
	public void printPermutation(String[] s, int i)
	{
		if(i == s.length)
		{
			for(int j=0;j<s.length;j++)
			{
				System.out.print(s[j]);
			}
			System.out.println("");
			System.out.println("=============================");
		}
		for(int k = i; k < s.length; k++)
		{
			swap(s,i,k);
			printPermutation(s,i+1);
			swap(s,i,k);
		}
	}
	
	public void swap(String[] s, int i, int j)
	{
		String tmp = s[i];
		s[i] = s[j];
		s[j] = tmp;
	}
}



